package com.huatai.model.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * minio 配置类
 * @author xuzy
 */
@Configuration
@ConfigurationProperties(prefix = "minio")
@Data
public class MinioConfig {

	/**
	 * 访问地址（ip + port）
	 */
	private String ENDPOINT;

	/**
	 * 账号
	 */
	private String ACCESS_KEY;

	/**
	 * 密码
	 */
	private String SECRET_KEY;

    @Bean
    public CustomMinioClient customMinioClient(){
        return
                CustomMinioClient.build(
                        CustomMinioClient
                                .builder()
                                .endpoint(ENDPOINT)
                                .credentials(ACCESS_KEY, SECRET_KEY)
                                .build());
    }
}
